package com.haixiaoke.saas.apartment.service.impl;

import com.haixiaoke.saas.common.utils.DateUtils;
import com.haixiaoke.saas.apartment.domain.ServiceFacilities;
import com.haixiaoke.saas.apartment.mapper.ServiceFacilitiesMapper;
import com.haixiaoke.saas.apartment.service.IServiceFacilitiesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 房屋设施Service业务层处理
 *
 * @author xiaolong
 * @date 2023-10-24
 */
@Service
public class ServiceFacilitiesServiceImpl implements IServiceFacilitiesService {
    @Autowired
    private ServiceFacilitiesMapper serviceFacilitiesMapper;

    /**
     * 查询房屋设施
     *
     * @param facilitiesId 房屋设施主键
     * @return 房屋设施
     */
    @Override
    public ServiceFacilities selectHouseFacilitiesByFacilitiesId(Long facilitiesId) {
        return serviceFacilitiesMapper.selectHouseFacilitiesByFacilitiesId(facilitiesId);
    }

    /**
     * 查询房屋设施列表
     *
     * @param serviceFacilities 房屋设施
     * @return 房屋设施
     */
    @Override
    public List<ServiceFacilities> selectHouseFacilitiesList(ServiceFacilities serviceFacilities) {
        return serviceFacilitiesMapper.selectHouseFacilitiesList(serviceFacilities);
    }

    /**
     * 新增房屋设施
     *
     * @param serviceFacilities 房屋设施
     * @return 结果
     */
    @Override
    public int insertHouseFacilities(ServiceFacilities serviceFacilities) {
        serviceFacilities.setCreateTime(DateUtils.getNowDate());
        return serviceFacilitiesMapper.insertHouseFacilities(serviceFacilities);
    }

    /**
     * 修改房屋设施
     *
     * @param serviceFacilities 房屋设施
     * @return 结果
     */
    @Override
    public int updateHouseFacilities(ServiceFacilities serviceFacilities) {
        serviceFacilities.setUpdateTime(DateUtils.getNowDate());
        return serviceFacilitiesMapper.updateHouseFacilities(serviceFacilities);
    }

    /**
     * 批量删除房屋设施
     *
     * @param facilitiesIds 需要删除的房屋设施主键
     * @return 结果
     */
    @Override
    public int deleteHouseFacilitiesByFacilitiesIds(Long[] facilitiesIds) {
        return serviceFacilitiesMapper.deleteHouseFacilitiesByFacilitiesIds(facilitiesIds);
    }

    /**
     * 删除房屋设施信息
     *
     * @param facilitiesId 房屋设施主键
     * @return 结果
     */
    @Override
    public int deleteHouseFacilitiesByFacilitiesId(Long facilitiesId) {
        return serviceFacilitiesMapper.deleteHouseFacilitiesByFacilitiesId(facilitiesId);
    }

    @Override
    public List<ServiceFacilities> selectBatchHouseFacilitiesByFacilitiesId(List<Long> facilitiesIds) {
        return serviceFacilitiesMapper.selectBatchHouseFacilitiesByFacilitiesId(facilitiesIds);
    }
}
